var vm_zhuanjia = new Vue({
    el: "#index",
    data: {
        deptid: $("#deptid").val(),		// deptid
        olddeptid: $("#olddeptid").val(),		// deptid
        jigoujibie: $("#jigoujibie").val(),		// deptid

        biandonglist: [],// 列表list

        //查询用字段
        zhuanjiamingcheng: "",
        danweimingcheng: "",
        cengji: "",
        biandongleixing: "",
        biandongriqi: "",

        pageindex: 1,		// 查询分页初始化页
        pagesize: 10,		// 查询分页初始化页面大小
        pageCount: 0,		// 总页数
        recordCount: 0,	// 总记录数
        targetpage: '', 	// 目标页
    },
    created: function () {
        var _this = this;

        _this.bindZhuanjiaList();

    },
    watch: {
        //监控分页情况，刷新列表
        pageindex: function () {
            this.bindZhuanjiaList();
        },

        pagesize: function () {
            this.bindZhuanjiaList();
        },
    },
    methods: {

        bindZhuanjiaList: function () {
            var _this = this;
            $.post('/system/zhuanjiabiandongdetail/lishizhuanjiabiandongList', {
                deptid: _this.olddeptid,
                zhuanjiamingcheng: _this.zhuanjiamingcheng,
                danweimingcheng: _this.danweimingcheng,
                cengji: _this.cengji,
                biandongleixing: _this.biandongleixing,
                biandongriqi: _this.biandongriqi,
                pageindex: _this.pageindex,
                pagesize: _this.pagesize,
                rdm: Math.random()
            }, function (ppData) {
                if (ppData != null) {
                    var data = ppData.resultContent;
                    _this.biandonglist = data.biandonglist;
                    var pageInfo = data.PageInfo;
                    _this.pageindex = pageInfo.pageIndex;
                    _this.pageCount = pageInfo.pageCount;
                    _this.recordCount = pageInfo.recordCount;
                    _this.targetpage = '';
                }
            }, "json");
        },

        reset: function () {
            var _this = this;

                _this.zhuanjiamingcheng= "",
                _this.danweimingcheng= "",
                _this.cengji= "",
                _this.biandongleixing= "",
                _this.biandongriqi= "",

                _this.pageindex = 1,		// 查询分页初始化页
                _this.pagesize = 10,		// 查询分页初始化页面大小
                _this.pageCount = 0,		// 总页数
                _this.recordCount = 0,	// 总记录数
                _this.targetpage = '', 	// 目标页
                _this.bindZhuanjiaList();
        },




		toShowHistory:function(ppZhuanjiaId){
			History.zhuanjiaid = ppZhuanjiaId;
			History.showHistoryModel();
		},

        getDate:function () {
            var _this = this;
            _this.biandongriqi=$("#biandongriqi").val();
        },

        //首页
        firstPage: function () {
            this.pageindex = 1;
        },
        //尾页
        lastPage: function () {
            this.pageindex = this.pageCount;
        },
        //上一页
        prePage: function () {
            var prePage = ((this.pageindex - 1) <= 0) ? 1 : (this.pageindex - 1);
            this.pageindex = prePage;
        },
        //下一页
        nextPage: function () {
            var nextPage = ((this.pageindex + 1) >= this.pageCount) ? this.pageCount : (this.pageindex + 1);
            this.pageindex = nextPage;
        },
        //跳到目标页
        targetPage: function () {
            if (this.targetpage != '' && this.targetpage <= this.pageCount && this.targetpage > 0) {
                this.pageindex = this.targetpage;
                this.targetpage = '';
            }
        },

    },
})